package net.xdclass.enums;

import lombok.Getter;

/**
 * 状态码定义约束，共6位数，前三位代表服务，后4位代表接口 比如 商品服务210,购物车是220、用户服务230，403代表权限
 * @author : zhen.xue
 * @Date: 2021-04-01 16:32
 */
public enum  BizCodeEnum {

    /**
     * 通用操作码
     */
    OPS_REPEAT(110001,"重复操作"),

    /**
     *验证码
     */
    CODE_TO_ERROR(240001,"接收号码不合规"),
    CODE_LIMITED(240002,"验证码发送过快"),
    CODE_ERROR(240003,"验证码错误"),
    CODE_CAPTCHA_ERROR(240101,"图形验证码错误"),

    /**
     * 账号
     */
    ACCOUNT_REPEAT(250001,"账号已经存在"),
    ACCOUNT_UNREGISTER(250002,"账号不存在"),
    ACCOUNT_PWD_ERROR(250003,"账号或者密码错误"),
    ACCOUNT_NOT_LOGIN(250004,"账号未登录"),

    /**
     * 文件相关
     */
    FILE_UPLOAD_USER_IMG_FAIL(600101, "用户头像上传失败"),

    /**
     * 地址模块
     */
    ADDRESS_NO_EXIT(290003,"地址不存在"),
    ADDRESS_DEL_FAIL(290004,"删除收货地址失败" ),


    /**
     * 优惠券模块
     */
    COUPON_UNAVAILABLE(270409,"没有优惠券可以使用"),
    COUPON_NO_EXITS(270003,"优惠卷不存在"),
    COUPON_NO_STOCK(270004, "优惠卷库存不足"),
    COUPON_OUT_OF_TIME(270005, "不在领取时间范围之内"),
    COUPON_OUT_OF_LIMIT(270006, "优惠券领取超过次数限制"),
    COUPON_GET_FAIL(270006, "优惠券领取失败"),
    COUPON_RECORD_LOCK_FAIL(270409, "优惠券锁定失败"),

    /**
     * 购物车
     */
    CART_FAIL(220001, "添加购物车失败"),

    /**
     * 订单相关
     */
    ORDER_CONFIRM_COUPON_FAIL(280001,"创建订单-优惠券使用失败，不满足价格条件" ),
    ORDER_CONFIRM_PRICE_FAIL(280002, "创建订单-验价失败"),
    ORDER_CONFIRM_LOCK_PRODUCT_FAIL(280003, "创建订单-商品库存不足锁定失败"),
    ORDER_CONFIRM_ADD_STOCK_TASK_FAIL(280003, "创建订单-商品库存锁定任务"),
    ORDER_CONFIRM_TOKEN_NOT_EXISTS(280008, "订单令牌缺少"),
    ORDER_CONFIRM_TOKEN_EQUAL_FAIL(280009, "订单令牌不正确"),
    ORDER_CONFIRM_NOT_EXISTS(280010,"订单不存在" ),
    ORDER_CONFIRM_CART_ITEM_NOT_EXISTS(280011,"购物车商品项不存在" ),

    /**
     * 支付
     */
    PAY_ORDER_FAIL(300001, "创建支付订单失败"),
    PAY_ORDER_CALLBACK_SING_FAIL(300002, "支付订单回调验签失败"),
    PAY_ORDER_CALLBACK_NOT_SUCCESS(300003, "支付宝回调更新订单失败"),
    PAY_ORDER_NOT_EXISTS(300005, "订单不存在"),
    PAY_ORDER_STATE_ERROR(300006, "订单状态不正常"),
    PAY_ORDER_PAY_TIMEOUT(300007, "订单支付超时"),
    CONTROL_FLOW(500101, "限流控制"),
    CONTROL_AUTH(500201, "认证控制"),
    CONTROL_DEGRADE(500301, "降级控制");






    @Getter
    private final int code;

    @Getter
    private final String message;

    BizCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }
}